import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'


import echarts from 'echarts'
import qs from 'qs'
import axios from 'axios'
Vue.prototype.$echarts = echarts;
Vue.config.productionTip = false
axios.defaults.with

axios.interceptors.request.use(
  (config) => {
        if (config.method=="post"){
            config.data = qs.stringify(config.data)
            config.headers['Content-Type'] = 'application/x-www-form-urlencoded'
        }
        return config;
      },
      (error) => {
      return Promise.reject(error);
});

Vue.prototype.$http = axios
axios.defaults.baseURL = 'http://127.0.0.1:8080'
axios({
  method:"post",
  url:"/baobiao/readBaobiao",
  params: {  //向后端传的参数
      id:'01'
  },
}).then(result => {
  localStorage.setItem("fangkuan",result.data.fangkuan)
  localStorage.setItem("daineishen",result.data.daineishen)
  localStorage.setItem("daiwaishen",result.data.daiwaishen)
  localStorage.setItem("caiwushenhe",result.data.caiwushenhe)
  localStorage.setItem("fangkuanjine",result.data.fangkuanjine)
  localStorage.setItem("yue1",result.data.yue1)
  localStorage.setItem("yue2",result.data.yue2)
  localStorage.setItem("yue3",result.data.yue3)
  localStorage.setItem("yue4",result.data.yue4)
  localStorage.setItem("yue5",result.data.yue5)
  localStorage.setItem("yue6",result.data.yue6)
  localStorage.setItem("yue7",result.data.yue7)
  localStorage.setItem("yue8",result.data.yue8)
  localStorage.setItem("yue9",result.data.yue9)
  localStorage.setItem("yue10",result.data.yue10)
  localStorage.setItem("yue11",result.data.yue11)
  localStorage.setItem("yue12",result.data.yue12)


    return result.data
  })
  .catch(error => {
    return error
  })
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
